#include <iostream>
#include <stdlib.h>
#include <time.h>
#include <unordered_map>
using namespace std;
#define M 1000000

int main()
{
    clock_t start, finish;
    unordered_map<long, void*> mymap;
    double Times;
    start = clock();
    for (long i = 0; i < M; i++)
    {
        void *ptr = malloc(i % 20);
        free(ptr);
    }
    finish = clock();
    Times = (double)(finish - start) / CLOCKS_PER_SEC;
    cout << "CLOCKS_PER_SEC " << Times << endl;

    start = clock();
    for (long i = 0; i < M; i++)
    {
        void *ptr = malloc(i % 20);
        free(ptr);
        mymap[i%20] = ptr;
    }
    finish = clock();
    Times = (double)(finish - start) / CLOCKS_PER_SEC;
    cout << "CLOCKS_PER_SEC " << Times << endl;

    return 0;
}